using System.Linq;
using ExampleWebApplication.Entities;
using ExampleWebApplication.Models;
using TelerikMvcGridCustomBindingHelper;

namespace ExampleWebApplication.Infraestruture.Aggregates
{
    class SumUnitPriceMultipliedByUnitsOnOrderAggregateFunction : GridCustomBindingHelper<Product, ProductModel>.CustomAggregateFunction
    {
        protected override object GetValue(IQueryable<Product> entities)
        {
            return entities.Sum(x => x.UnitPrice * x.Units_On_Order);
        }
    }
}